package com.wwh.mapper;

import com.wwh.model.Post;
import com.wwh.model.Relation;
import com.wwh.model.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface RelationMapper {
    @Insert(" insert into relation_ ( user_id, post_id, created_at, updated_at ) values (#{user_id}, #{post_id}, unix_timestamp(now()), unix_timestamp(now())) ")
    public int save(Relation relation);


    @Select("select * from relation_ where user_id=#{user_id} and post_id=#{post_id}")
    public Relation search(@Param("user_id") int user_id, @Param("post_id") int post_id);
}
